import request from '@/utils/request'

export function getFruitByPage(data) {
  return request({
    url: '/fruit',
    params: { ...data }
  })
}

export function getMyFruit(data) {
  return request({
    url: '/fruit/getMyFruit',
    params: { ...data }
  })
}

export function getFruitById(id) {
  return request({
    url: `/fruit/${id}`,
  })
}

export function getByCategory(id) {
  return request({
    url: `/fruit/getByCategory/${id}`,
  })
}

export function addFruit(data) {
  return request({
    url: '/fruit',
    method: 'post',
    data: data
  })
}

export function updateFruitById(data) {
  return request({
    url: `/fruit`,
    method: 'put',
    data: data
  })
}

export function deleteFruit(id) {
  return request({
    url: `/fruit/${id}`,
    method: 'delete',
  })
}

export function batchDeleteFruit(idList) {
  return request({
    url: `/fruit/batchDelete`,
    method: 'post',
    data: idList
  })
}
